blob: 8489cf51afbf6e1d79af1b248d094c7fcae554b8 [file] [log] [blame]
Junio C Hamanod9d71c02006-02-08 00:52:331<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Junio C Hamanoba4b9282008-07-06 05:20:316<meta name="generator" content="AsciiDoc 8.2.5" />
Junio C Hamanod9d71c02006-02-08 00:52:337<style type="text/css">
8/* Debug borders */
9p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
10/*
11 border: 1px solid red;
12*/
13}
14
15body {
16 margin: 1em 5% 1em 5%;
17}
18
Junio C Hamanoba4b9282008-07-06 05:20:3119a {
20 color: blue;
21 text-decoration: underline;
22}
23a:visited {
24 color: fuchsia;
25}
Junio C Hamanod9d71c02006-02-08 00:52:3326
27em {
28 font-style: italic;
29}
30
31strong {
32 font-weight: bold;
33}
34
35tt {
36 color: navy;
37}
38
39h1, h2, h3, h4, h5, h6 {
40 color: #527bbd;
41 font-family: sans-serif;
42 margin-top: 1.2em;
43 margin-bottom: 0.5em;
44 line-height: 1.3;
45}
46
Junio C Hamanoba4b9282008-07-06 05:20:3147h1, h2, h3 {
Junio C Hamanod9d71c02006-02-08 00:52:3348 border-bottom: 2px solid silver;
49}
50h2 {
Junio C Hamanod9d71c02006-02-08 00:52:3351 padding-top: 0.5em;
52}
Junio C Hamanoba4b9282008-07-06 05:20:3153h3 {
54 float: left;
55}
56h3 + * {
57 clear: left;
58}
Junio C Hamanod9d71c02006-02-08 00:52:3359
60div.sectionbody {
61 font-family: serif;
62 margin-left: 0;
63}
64
65hr {
66 border: 1px solid silver;
67}
68
69p {
70 margin-top: 0.5em;
71 margin-bottom: 0.5em;
72}
73
74pre {
75 padding: 0;
76 margin: 0;
77}
78
79span#author {
80 color: #527bbd;
81 font-family: sans-serif;
82 font-weight: bold;
Junio C Hamanoba4b9282008-07-06 05:20:3183 font-size: 1.1em;
Junio C Hamanod9d71c02006-02-08 00:52:3384}
85span#email {
86}
87span#revision {
88 font-family: sans-serif;
89}
90
91div#footer {
92 font-family: sans-serif;
93 font-size: small;
94 border-top: 2px solid silver;
95 padding-top: 0.5em;
96 margin-top: 4.0em;
97}
98div#footer-text {
99 float: left;
100 padding-bottom: 0.5em;
101}
102div#footer-badges {
103 float: right;
104 padding-bottom: 0.5em;
105}
106
107div#preamble,
108div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
109div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
110div.admonitionblock {
111 margin-right: 10%;
112 margin-top: 1.5em;
113 margin-bottom: 1.5em;
114}
115div.admonitionblock {
116 margin-top: 2.5em;
117 margin-bottom: 2.5em;
118}
119
120div.content { /* Block element content. */
121 padding: 0;
122}
123
124/* Block element titles. */
125div.title, caption.title {
126 font-family: sans-serif;
127 font-weight: bold;
128 text-align: left;
129 margin-top: 1.0em;
130 margin-bottom: 0.5em;
131}
132div.title + * {
133 margin-top: 0;
134}
135
136td div.title:first-child {
137 margin-top: 0.0em;
138}
139div.content div.title:first-child {
140 margin-top: 0.0em;
141}
142div.content + div.title {
143 margin-top: 0.0em;
144}
145
146div.sidebarblock > div.content {
147 background: #ffffee;
148 border: 1px solid silver;
149 padding: 0.5em;
150}
151
Junio C Hamanoba4b9282008-07-06 05:20:31152div.listingblock {
153 margin-right: 0%;
154}
Junio C Hamanod9d71c02006-02-08 00:52:33155div.listingblock > div.content {
156 border: 1px solid silver;
157 background: #f4f4f4;
158 padding: 0.5em;
159}
160
161div.quoteblock > div.content {
162 padding-left: 2.0em;
163}
Junio C Hamanoba4b9282008-07-06 05:20:31164
165div.attribution {
Junio C Hamanod9d71c02006-02-08 00:52:33166 text-align: right;
167}
Junio C Hamanoba4b9282008-07-06 05:20:31168div.verseblock + div.attribution {
169 text-align: left;
170}
Junio C Hamanod9d71c02006-02-08 00:52:33171
172div.admonitionblock .icon {
173 vertical-align: top;
174 font-size: 1.1em;
175 font-weight: bold;
176 text-decoration: underline;
177 color: #527bbd;
178 padding-right: 0.5em;
179}
180div.admonitionblock td.content {
181 padding-left: 0.5em;
182 border-left: 2px solid silver;
183}
184
185div.exampleblock > div.content {
186 border-left: 2px solid silver;
187 padding: 0.5em;
188}
189
190div.verseblock div.content {
191 white-space: pre;
192}
193
194div.imageblock div.content { padding-left: 0; }
195div.imageblock img { border: 1px solid silver; }
196span.image img { border-style: none; }
197
198dl {
199 margin-top: 0.8em;
200 margin-bottom: 0.8em;
201}
202dt {
203 margin-top: 0.5em;
204 margin-bottom: 0;
205 font-style: italic;
206}
207dd > *:first-child {
208 margin-top: 0;
209}
210
211ul, ol {
212 list-style-position: outside;
213}
Junio C Hamanoba4b9282008-07-06 05:20:31214div.olist2 ol {
Junio C Hamanod9d71c02006-02-08 00:52:33215 list-style-type: lower-alpha;
216}
217
218div.tableblock > table {
Junio C Hamanoba4b9282008-07-06 05:20:31219 border: 3px solid #527bbd;
Junio C Hamanod9d71c02006-02-08 00:52:33220}
221thead {
222 font-family: sans-serif;
223 font-weight: bold;
224}
225tfoot {
226 font-weight: bold;
227}
228
229div.hlist {
230 margin-top: 0.8em;
231 margin-bottom: 0.8em;
232}
Junio C Hamanoba4b9282008-07-06 05:20:31233div.hlist td {
234 padding-bottom: 5px;
235}
Junio C Hamanod9d71c02006-02-08 00:52:33236td.hlist1 {
237 vertical-align: top;
238 font-style: italic;
239 padding-right: 0.8em;
240}
241td.hlist2 {
242 vertical-align: top;
243}
244
245@media print {
246 div#footer-badges { display: none; }
247}
Junio C Hamanoba4b9282008-07-06 05:20:31248
249div#toctitle {
250 color: #527bbd;
251 font-family: sans-serif;
252 font-size: 1.1em;
253 font-weight: bold;
254 margin-top: 1.0em;
255 margin-bottom: 0.1em;
256}
257
258div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
259 margin-top: 0;
260 margin-bottom: 0;
261}
262div.toclevel2 {
263 margin-left: 2em;
264 font-size: 0.9em;
265}
266div.toclevel3 {
267 margin-left: 4em;
268 font-size: 0.9em;
269}
270div.toclevel4 {
271 margin-left: 6em;
272 font-size: 0.9em;
273}
274include1::./stylesheets/xhtml11-manpage.css[]
Junio C Hamanod9d71c02006-02-08 00:52:33275/* Workarounds for IE6's broken and incomplete CSS2. */
276
277div.sidebar-content {
278 background: #ffffee;
279 border: 1px solid silver;
280 padding: 0.5em;
281}
282div.sidebar-title, div.image-title {
283 font-family: sans-serif;
284 font-weight: bold;
285 margin-top: 0.0em;
286 margin-bottom: 0.5em;
287}
288
289div.listingblock div.content {
290 border: 1px solid silver;
291 background: #f4f4f4;
292 padding: 0.5em;
293}
294
295div.quoteblock-content {
296 padding-left: 2.0em;
297}
298
299div.exampleblock-content {
300 border-left: 2px solid silver;
301 padding-left: 0.5em;
302}
Junio C Hamanoba4b9282008-07-06 05:20:31303
304/* IE6 sets dynamically generated links as visited. */
305div#toc a:visited { color: blue; }
Junio C Hamanod9d71c02006-02-08 00:52:33306</style>
307<title>git-show(1)</title>
308</head>
309<body>
310<div id="header">
311<h1>
312git-show(1) Manual Page
313</h1>
314<h2>NAME</h2>
315<div class="sectionbody">
316<p>git-show -
Junio C Hamano7d23f5e2006-12-16 07:44:04317 Show various types of objects
Junio C Hamanod9d71c02006-02-08 00:52:33318</p>
319</div>
320</div>
321<h2>SYNOPSIS</h2>
322<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31323<div class="para"><p><em>git show</em> [options] &lt;object&gt;&#8230;</p></div>
Junio C Hamanod9d71c02006-02-08 00:52:33324</div>
Junio C Hamanoba4b9282008-07-06 05:20:31325<h2 id="_description">DESCRIPTION</h2>
Junio C Hamanod9d71c02006-02-08 00:52:33326<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31327<div class="para"><p>Shows one or more objects (blobs, trees, tags and commits).</p></div>
328<div class="para"><p>For commits it shows the log message and textual diff. It also
Junio C Hamano7d23f5e2006-12-16 07:44:04329presents the merge commit in a special format as produced by
Junio C Hamanoba4b9282008-07-06 05:20:31330<em>git-diff-tree --cc</em>.</p></div>
331<div class="para"><p>For tags, it shows the tag message and the referenced objects.</p></div>
332<div class="para"><p>For trees, it shows the names (equivalent to <em>git-ls-tree</em>
333with --name-only).</p></div>
334<div class="para"><p>For plain blobs, it shows the plain contents.</p></div>
335<div class="para"><p>The command takes options applicable to the <em>git-diff-tree</em> command to
336control how the changes the commit introduces are shown.</p></div>
337<div class="para"><p>This manual page describes only the most frequently used options.</p></div>
Junio C Hamanod9d71c02006-02-08 00:52:33338</div>
Junio C Hamanoba4b9282008-07-06 05:20:31339<h2 id="_options">OPTIONS</h2>
Junio C Hamanod9d71c02006-02-08 00:52:33340<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31341<div class="vlist"><dl>
Junio C Hamanod9d71c02006-02-08 00:52:33342<dt>
Junio C Hamano9e395072008-07-31 22:11:21343&lt;object&gt;&#8230;
Junio C Hamanod9d71c02006-02-08 00:52:33344</dt>
345<dd>
346<p>
Junio C Hamano9e395072008-07-31 22:11:21347 The names of objects to show.
Junio C Hamano2d47c622007-01-18 06:24:10348 For a more complete list of ways to spell object names, see
349 "SPECIFYING REVISIONS" section in <a href="git-rev-parse.html">git-rev-parse(1)</a>.
Junio C Hamanod9d71c02006-02-08 00:52:33350</p>
351</dd>
352<dt>
Junio C Hamanoa340aaa2006-11-23 02:47:33353--pretty[=<em>&lt;format&gt;</em>]
Junio C Hamanod9d71c02006-02-08 00:52:33354</dt>
Junio C Hamano0a235222009-03-06 08:21:09355<dt>
356--format[=<em>&lt;format&gt;</em>]
357</dt>
Junio C Hamanod9d71c02006-02-08 00:52:33358<dd>
359<p>
Junio C Hamanoa3770f92007-07-25 08:53:33360 Pretty-print the contents of the commit logs in a given format,
Junio C Hamano0430e3a2007-05-15 03:13:17361 where <em>&lt;format&gt;</em> can be one of <em>oneline</em>, <em>short</em>, <em>medium</em>,
362 <em>full</em>, <em>fuller</em>, <em>email</em>, <em>raw</em> and <em>format:&lt;string&gt;</em>.
Junio C Hamanoa3770f92007-07-25 08:53:33363 When omitted, the format defaults to <em>medium</em>.
Junio C Hamanod9d71c02006-02-08 00:52:33364</p>
Junio C Hamanoba4b9282008-07-06 05:20:31365<div class="para"><p>Note: you can specify the default pretty format in the repository
366configuration (see <a href="git-config.html">git-config(1)</a>).</p></div>
Junio C Hamano0430e3a2007-05-15 03:13:17367</dd>
368<dt>
Junio C Hamanoee695f22007-06-21 00:35:36369--abbrev-commit
370</dt>
371<dd>
372<p>
373 Instead of showing the full 40-byte hexadecimal commit object
Junio C Hamano6efe3022009-01-13 16:47:56374 name, show only a partial prefix. Non default number of
Junio C Hamanoee695f22007-06-21 00:35:36375 digits can be specified with "--abbrev=&lt;n&gt;" (which also modifies
376 diff output, if it is displayed).
377</p>
Junio C Hamanoba4b9282008-07-06 05:20:31378<div class="para"><p>This should make "--pretty=oneline" a whole lot more readable for
379people using 80-column terminals.</p></div>
Junio C Hamanoee695f22007-06-21 00:35:36380</dd>
381<dt>
Junio C Hamano0a235222009-03-06 08:21:09382--oneline
383</dt>
384<dd>
385<p>
386 This is a shorthand for "--pretty=oneline --abbrev-commit"
387 used together.
388</p>
389</dd>
390<dt>
Junio C Hamano0430e3a2007-05-15 03:13:17391--encoding[=&lt;encoding&gt;]
392</dt>
393<dd>
394<p>
395 The commit objects record the encoding used for the log message
396 in their encoding header; this option can be used to tell the
397 command to re-code the commit log message in the encoding
398 preferred by the user. For non plumbing commands this
399 defaults to UTF-8.
400</p>
401</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31402</dl></div>
Junio C Hamano0430e3a2007-05-15 03:13:17403</div>
Junio C Hamanoba4b9282008-07-06 05:20:31404<h2 id="_pretty_formats">PRETTY FORMATS</h2>
Junio C Hamano0430e3a2007-05-15 03:13:17405<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31406<div class="para"><p>If the commit is a merge, and if the pretty-format
Junio C Hamano0430e3a2007-05-15 03:13:17407is not <em>oneline</em>, <em>email</em> or <em>raw</em>, an additional line is
408inserted before the <em>Author:</em> line. This line begins with
409"Merge: " and the sha1s of ancestral commits are printed,
410separated by spaces. Note that the listed commits may not
411necessarily be the list of the <strong>direct</strong> parent commits if you
412have limited your view of history: for example, if you are
413only interested in changes related to a certain directory or
Junio C Hamanoba4b9282008-07-06 05:20:31414file.</p></div>
415<div class="para"><p>Here are some additional details for each format:</p></div>
416<div class="ilist"><ul>
Junio C Hamanoa340aaa2006-11-23 02:47:33417<li>
418<p>
419<em>oneline</em>
420</p>
421<div class="literalblock">
422<div class="content">
423<pre><tt>&lt;sha1&gt; &lt;title line&gt;</tt></pre>
424</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31425<div class="para"><p>This is designed to be as compact as possible.</p></div>
Junio C Hamanoa340aaa2006-11-23 02:47:33426</li>
427<li>
428<p>
429<em>short</em>
430</p>
431<div class="literalblock">
432<div class="content">
433<pre><tt>commit &lt;sha1&gt;
434Author: &lt;author&gt;</tt></pre>
435</div></div>
436<div class="literalblock">
437<div class="content">
438<pre><tt>&lt;title line&gt;</tt></pre>
439</div></div>
440</li>
441<li>
442<p>
443<em>medium</em>
444</p>
445<div class="literalblock">
446<div class="content">
447<pre><tt>commit &lt;sha1&gt;
448Author: &lt;author&gt;
Junio C Hamano6a3c8272008-12-19 21:38:18449Date: &lt;author date&gt;</tt></pre>
Junio C Hamanoa340aaa2006-11-23 02:47:33450</div></div>
451<div class="literalblock">
452<div class="content">
453<pre><tt>&lt;title line&gt;</tt></pre>
454</div></div>
455<div class="literalblock">
456<div class="content">
457<pre><tt>&lt;full commit message&gt;</tt></pre>
458</div></div>
459</li>
460<li>
461<p>
462<em>full</em>
463</p>
464<div class="literalblock">
465<div class="content">
466<pre><tt>commit &lt;sha1&gt;
467Author: &lt;author&gt;
468Commit: &lt;committer&gt;</tt></pre>
469</div></div>
470<div class="literalblock">
471<div class="content">
472<pre><tt>&lt;title line&gt;</tt></pre>
473</div></div>
474<div class="literalblock">
475<div class="content">
476<pre><tt>&lt;full commit message&gt;</tt></pre>
477</div></div>
478</li>
479<li>
480<p>
481<em>fuller</em>
482</p>
483<div class="literalblock">
484<div class="content">
485<pre><tt>commit &lt;sha1&gt;
Junio C Hamano6a3c8272008-12-19 21:38:18486Author: &lt;author&gt;
Junio C Hamanoba4b9282008-07-06 05:20:31487AuthorDate: &lt;author date&gt;
Junio C Hamano6a3c8272008-12-19 21:38:18488Commit: &lt;committer&gt;
Junio C Hamanoba4b9282008-07-06 05:20:31489CommitDate: &lt;committer date&gt;</tt></pre>
Junio C Hamanoa340aaa2006-11-23 02:47:33490</div></div>
491<div class="literalblock">
492<div class="content">
493<pre><tt>&lt;title line&gt;</tt></pre>
494</div></div>
495<div class="literalblock">
496<div class="content">
497<pre><tt>&lt;full commit message&gt;</tt></pre>
498</div></div>
499</li>
500<li>
501<p>
502<em>email</em>
503</p>
504<div class="literalblock">
505<div class="content">
506<pre><tt>From &lt;sha1&gt; &lt;date&gt;
507From: &lt;author&gt;
Junio C Hamanoba4b9282008-07-06 05:20:31508Date: &lt;author date&gt;
Junio C Hamanoa340aaa2006-11-23 02:47:33509Subject: [PATCH] &lt;title line&gt;</tt></pre>
510</div></div>
511<div class="literalblock">
512<div class="content">
Junio C Hamano0430e3a2007-05-15 03:13:17513<pre><tt>&lt;full commit message&gt;</tt></pre>
Junio C Hamanoa340aaa2006-11-23 02:47:33514</div></div>
515</li>
516<li>
517<p>
518<em>raw</em>
519</p>
Junio C Hamanoba4b9282008-07-06 05:20:31520<div class="para"><p>The <em>raw</em> format shows the entire commit exactly as
Junio C Hamanoa340aaa2006-11-23 02:47:33521stored in the commit object. Notably, the SHA1s are
522displayed in full, regardless of whether --abbrev or
523--no-abbrev are used, and <em>parents</em> information show the
524true parent commits, without taking grafts nor history
Junio C Hamanoba4b9282008-07-06 05:20:31525simplification into account.</p></div>
Junio C Hamanoa340aaa2006-11-23 02:47:33526</li>
Junio C Hamanoa3fd83c2007-03-02 10:34:36527<li>
528<p>
529<em>format:</em>
530</p>
Junio C Hamanoba4b9282008-07-06 05:20:31531<div class="para"><p>The <em>format:</em> format allows you to specify which information
Junio C Hamanoa3fd83c2007-03-02 10:34:36532you want to show. It works a little bit like printf format,
533with the notable exception that you get a newline with <em>%n</em>
Junio C Hamanoba4b9282008-07-06 05:20:31534instead of <em>\n</em>.</p></div>
535<div class="para"><p>E.g, <em>format:"The author of %h was %an, %ar%nThe title was &gt;&gt;%s&lt;&lt;%n"</em>
536would show something like this:</p></div>
Junio C Hamano0430e3a2007-05-15 03:13:17537<div class="listingblock">
538<div class="content">
539<pre><tt>The author of fe6e0ee was Junio C Hamano, 23 hours ago
540The title was &gt;&gt;t4119: test autocomputing -p&lt;n&gt; for traditional diff input.&lt;&lt;
541</tt></pre>
542</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31543<div class="para"><p>The placeholders are:</p></div>
544<div class="ilist"><ul>
Junio C Hamanoa3fd83c2007-03-02 10:34:36545<li>
546<p>
547<em>%H</em>: commit hash
548</p>
549</li>
550<li>
551<p>
552<em>%h</em>: abbreviated commit hash
553</p>
554</li>
555<li>
556<p>
557<em>%T</em>: tree hash
558</p>
559</li>
560<li>
561<p>
562<em>%t</em>: abbreviated tree hash
563</p>
564</li>
565<li>
566<p>
567<em>%P</em>: parent hashes
568</p>
569</li>
570<li>
571<p>
572<em>%p</em>: abbreviated parent hashes
573</p>
574</li>
575<li>
576<p>
577<em>%an</em>: author name
578</p>
579</li>
580<li>
581<p>
Junio C Hamano8bc410e2009-02-15 10:38:19582<em>%aN</em>: author name (respecting .mailmap, see <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
Junio C Hamanof5a93622008-07-16 03:23:57583</p>
584</li>
585<li>
586<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:36587<em>%ae</em>: author email
588</p>
589</li>
590<li>
591<p>
Junio C Hamano8bc410e2009-02-15 10:38:19592<em>%aE</em>: author email (respecting .mailmap, see <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
593</p>
594</li>
595<li>
596<p>
Junio C Hamanoa387df32008-08-29 08:56:58597<em>%ad</em>: author date (format respects --date= option)
Junio C Hamanoa3fd83c2007-03-02 10:34:36598</p>
599</li>
600<li>
601<p>
602<em>%aD</em>: author date, RFC2822 style
603</p>
604</li>
605<li>
606<p>
607<em>%ar</em>: author date, relative
608</p>
609</li>
610<li>
611<p>
612<em>%at</em>: author date, UNIX timestamp
613</p>
614</li>
615<li>
616<p>
Junio C Hamano02f130b2007-07-14 08:26:56617<em>%ai</em>: author date, ISO 8601 format
618</p>
619</li>
620<li>
621<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:36622<em>%cn</em>: committer name
623</p>
624</li>
625<li>
626<p>
Junio C Hamano8bc410e2009-02-15 10:38:19627<em>%cN</em>: committer name (respecting .mailmap, see <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
Junio C Hamanof5a93622008-07-16 03:23:57628</p>
629</li>
630<li>
631<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:36632<em>%ce</em>: committer email
633</p>
634</li>
635<li>
636<p>
Junio C Hamano8bc410e2009-02-15 10:38:19637<em>%cE</em>: committer email (respecting .mailmap, see <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
638</p>
639</li>
640<li>
641<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:36642<em>%cd</em>: committer date
643</p>
644</li>
645<li>
646<p>
647<em>%cD</em>: committer date, RFC2822 style
648</p>
649</li>
650<li>
651<p>
652<em>%cr</em>: committer date, relative
653</p>
654</li>
655<li>
656<p>
657<em>%ct</em>: committer date, UNIX timestamp
658</p>
659</li>
660<li>
661<p>
Junio C Hamano02f130b2007-07-14 08:26:56662<em>%ci</em>: committer date, ISO 8601 format
663</p>
664</li>
665<li>
666<p>
Junio C Hamano5e4d8de2008-09-19 06:27:02667<em>%d</em>: ref names, like the --decorate option of <a href="git-log.html">git-log(1)</a>
668</p>
669</li>
670<li>
671<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:36672<em>%e</em>: encoding
673</p>
674</li>
675<li>
676<p>
677<em>%s</em>: subject
678</p>
679</li>
680<li>
681<p>
Junio C Hamano5f9a6f02009-04-06 08:26:56682<em>%f</em>: sanitized subject line, suitable for a filename
683</p>
684</li>
685<li>
686<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:36687<em>%b</em>: body
688</p>
689</li>
690<li>
691<p>
Junio C Hamano3b70d3c2009-11-21 17:37:37692<em>%N</em>: commit notes
693</p>
694</li>
695<li>
696<p>
Junio C Hamanoc21ab052009-10-31 04:03:55697<em>%gD</em>: reflog selector, e.g., <tt>refs/stash@{1}</tt>
698</p>
699</li>
700<li>
701<p>
702<em>%gd</em>: shortened reflog selector, e.g., <tt>stash@{1}</tt>
703</p>
704</li>
705<li>
706<p>
707<em>%gs</em>: reflog subject
708</p>
709</li>
710<li>
711<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:36712<em>%Cred</em>: switch color to red
713</p>
714</li>
715<li>
716<p>
717<em>%Cgreen</em>: switch color to green
718</p>
719</li>
720<li>
721<p>
722<em>%Cblue</em>: switch color to blue
723</p>
724</li>
725<li>
726<p>
727<em>%Creset</em>: reset color
728</p>
729</li>
730<li>
731<p>
Junio C Hamanocc0cb312009-01-22 03:38:50732<em>%C(&#8230;)</em>: color specification, as described in color.branch.* config option
733</p>
734</li>
735<li>
736<p>
Junio C Hamanod9e0e5d2007-04-14 16:22:04737<em>%m</em>: left, right or boundary mark
738</p>
739</li>
740<li>
741<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:36742<em>%n</em>: newline
743</p>
Junio C Hamano0430e3a2007-05-15 03:13:17744</li>
Junio C Hamanob78d2592008-04-09 09:39:08745<li>
746<p>
Junio C Hamanoa9701f02010-01-21 00:42:16747<em>%%</em>: a raw <em>%</em>
748</p>
749</li>
750<li>
751<p>
Junio C Hamanob78d2592008-04-09 09:39:08752<em>%x00</em>: print a byte from a hex code
753</p>
754</li>
Junio C Hamanobf984de2009-11-23 06:11:19755<li>
756<p>
757<em>%w([&lt;w&gt;[,&lt;i1&gt;[,&lt;i2&gt;]]])</em>: switch line wrapping, like the -w option of
Junio C Hamano5706e0b2009-11-24 10:54:16758 <a href="git-shortlog.html">git-shortlog(1)</a>.
Junio C Hamanobf984de2009-11-23 06:11:19759</p>
760</li>
Junio C Hamanoba4b9282008-07-06 05:20:31761</ul></div>
Junio C Hamanoa3fd83c2007-03-02 10:34:36762</li>
Junio C Hamanoc21ab052009-10-31 04:03:55763</ul></div>
764<div class="admonitionblock">
765<table><tr>
766<td class="icon">
767<div class="title">Note</div>
768</td>
769<td class="content">Some placeholders may depend on other options given to the
770revision traversal engine. For example, the <tt>%g*</tt> reflog options will
771insert an empty string unless we are traversing reflog entries (e.g., by
772<tt>git log -g</tt>). The <tt>%d</tt> placeholder will use the "short" decoration
773format if <tt>--decorate</tt> was not already provided on the command line.</td>
774</tr></table>
775</div>
Junio C Hamano2bd8a742009-12-01 21:16:59776<div class="para"><p>If you add a <tt>&#43;</tt> (plus sign) after <em>%</em> of a placeholder, a line-feed
777is inserted immediately before the expansion if and only if the
778placeholder expands to a non-empty string.</p></div>
779<div class="para"><p>If you add a <tt>-</tt> (minus sign) after <em>%</em> of a placeholder, line-feeds that
780immediately precede the expansion are deleted if and only if the
781placeholder expands to an empty string.</p></div>
Junio C Hamanoc21ab052009-10-31 04:03:55782<div class="ilist"><ul>
Junio C Hamano6fb124c2008-06-13 10:04:01783<li>
784<p>
785<em>tformat:</em>
786</p>
Junio C Hamanoba4b9282008-07-06 05:20:31787<div class="para"><p>The <em>tformat:</em> format works exactly like <em>format:</em>, except that it
Junio C Hamano6fb124c2008-06-13 10:04:01788provides "terminator" semantics instead of "separator" semantics. In
789other words, each commit has the message terminator character (usually a
790newline) appended, rather than a separator placed between entries.
791This means that the final entry of a single-line format will be properly
792terminated with a new line, just as the "oneline" format does.
Junio C Hamanoba4b9282008-07-06 05:20:31793For example:</p></div>
Junio C Hamano6fb124c2008-06-13 10:04:01794<div class="listingblock">
795<div class="content">
796<pre><tt>$ git log -2 --pretty=format:%h 4da45bef \
797 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
7984da45be
7997134973 -- NO NEWLINE
800
801$ git log -2 --pretty=tformat:%h 4da45bef \
802 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
8034da45be
8047134973</tt></pre>
805</div></div>
Junio C Hamano0a235222009-03-06 08:21:09806<div class="para"><p>In addition, any unrecognized string that has a <tt>%</tt> in it is interpreted
807as if it has <tt>tformat:</tt> in front of it. For example, these two are
808equivalent:</p></div>
809<div class="listingblock">
810<div class="content">
811<pre><tt>$ git log -2 --pretty=tformat:%h 4da45bef
812$ git log -2 --pretty=%h 4da45bef</tt></pre>
813</div></div>
Junio C Hamano6fb124c2008-06-13 10:04:01814</li>
Junio C Hamanoba4b9282008-07-06 05:20:31815</ul></div>
Junio C Hamanod9d71c02006-02-08 00:52:33816</div>
Junio C Hamanoba4b9282008-07-06 05:20:31817<h2 id="_examples">EXAMPLES</h2>
Junio C Hamano7d23f5e2006-12-16 07:44:04818<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31819<div class="vlist"><dl>
Junio C Hamano7d23f5e2006-12-16 07:44:04820<dt>
821git show v1.0.0
822</dt>
823<dd>
824<p>
Junio C Hamano775a0f42006-12-31 01:19:14825 Shows the tag <tt>v1.0.0</tt>, along with the object the tags
826 points at.
Junio C Hamano7d23f5e2006-12-16 07:44:04827</p>
828</dd>
829<dt>
Junio C Hamanodb911ee2007-02-28 08:13:52830git show v1.0.0^{tree}
Junio C Hamano7d23f5e2006-12-16 07:44:04831</dt>
832<dd>
833<p>
834 Shows the tree pointed to by the tag <tt>v1.0.0</tt>.
835</p>
836</dd>
Junio C Hamanodb911ee2007-02-28 08:13:52837<dt>
838git show next~10:Documentation/README
839</dt>
840<dd>
841<p>
Junio C Hamano7d23f5e2006-12-16 07:44:04842 Shows the contents of the file <tt>Documentation/README</tt> as
843 they were current in the 10th last commit of the branch
Junio C Hamanodb911ee2007-02-28 08:13:52844 <tt>next</tt>.
845</p>
846</dd>
847<dt>
848git show master:Makefile master:t/Makefile
849</dt>
850<dd>
851<p>
Junio C Hamano7d23f5e2006-12-16 07:44:04852 Concatenates the contents of said Makefiles in the head
Junio C Hamanodb911ee2007-02-28 08:13:52853 of the branch <tt>master</tt>.
854</p>
855</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31856</dl></div>
Junio C Hamano7d23f5e2006-12-16 07:44:04857</div>
Junio C Hamanoba4b9282008-07-06 05:20:31858<h2 id="_discussion">Discussion</h2>
Junio C Hamano775a0f42006-12-31 01:19:14859<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31860<div class="para"><p>At the core level, git is character encoding agnostic.</p></div>
861<div class="ilist"><ul>
Junio C Hamano775a0f42006-12-31 01:19:14862<li>
863<p>
864The pathnames recorded in the index and in the tree objects
865 are treated as uninterpreted sequences of non-NUL bytes.
866 What readdir(2) returns are what are recorded and compared
867 with the data git keeps track of, which in turn are expected
868 to be what lstat(2) and creat(2) accepts. There is no such
869 thing as pathname encoding translation.
870</p>
871</li>
872<li>
873<p>
Junio C Hamano54bf1e22008-12-20 06:30:11874The contents of the blob objects are uninterpreted sequences
Junio C Hamano775a0f42006-12-31 01:19:14875 of bytes. There is no encoding translation at the core
876 level.
877</p>
878</li>
879<li>
880<p>
Junio C Hamano54bf1e22008-12-20 06:30:11881The commit log messages are uninterpreted sequences of non-NUL
Junio C Hamano775a0f42006-12-31 01:19:14882 bytes.
883</p>
884</li>
Junio C Hamanoba4b9282008-07-06 05:20:31885</ul></div>
886<div class="para"><p>Although we encourage that the commit log messages are encoded
Junio C Hamano775a0f42006-12-31 01:19:14887in UTF-8, both the core and git Porcelain are designed not to
888force UTF-8 on projects. If all participants of a particular
889project find it more convenient to use legacy encodings, git
890does not forbid it. However, there are a few things to keep in
Junio C Hamanoba4b9282008-07-06 05:20:31891mind.</p></div>
892<div class="olist"><ol>
Junio C Hamano775a0f42006-12-31 01:19:14893<li>
894<p>
Junio C Hamano37276192008-09-04 00:24:07895<em>git-commit</em> and <em>git-commit-tree</em> issues
Junio C Hamano14b76482008-01-05 10:32:26896 a warning if the commit log message given to it does not look
Junio C Hamano775a0f42006-12-31 01:19:14897 like a valid UTF-8 string, unless you explicitly say your
898 project uses a legacy encoding. The way to say this is to
Junio C Hamano35bb3f62007-02-19 05:35:53899 have i18n.commitencoding in <tt>.git/config</tt> file, like this:
Junio C Hamano775a0f42006-12-31 01:19:14900</p>
901<div class="listingblock">
902<div class="content">
Junio C Hamano35bb3f62007-02-19 05:35:53903<pre><tt>[i18n]
Junio C Hamano775a0f42006-12-31 01:19:14904 commitencoding = ISO-8859-1</tt></pre>
905</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31906<div class="para"><p>Commit objects created with the above setting record the value
Junio C Hamano35bb3f62007-02-19 05:35:53907of <tt>i18n.commitencoding</tt> in its <tt>encoding</tt> header. This is to
Junio C Hamano775a0f42006-12-31 01:19:14908help other people who look at them later. Lack of this header
Junio C Hamanoba4b9282008-07-06 05:20:31909implies that the commit log message is encoded in UTF-8.</p></div>
Junio C Hamano775a0f42006-12-31 01:19:14910</li>
911<li>
912<p>
Junio C Hamanoaa17c7c2008-11-03 04:36:58913<em>git-log</em>, <em>git-show</em>, <em>git-blame</em> and friends look at the
914 <tt>encoding</tt> header of a commit object, and try to re-code the
915 log message into UTF-8 unless otherwise specified. You can
Junio C Hamano775a0f42006-12-31 01:19:14916 specify the desired output encoding with
Junio C Hamano35bb3f62007-02-19 05:35:53917 <tt>i18n.logoutputencoding</tt> in <tt>.git/config</tt> file, like this:
Junio C Hamano775a0f42006-12-31 01:19:14918</p>
919<div class="listingblock">
920<div class="content">
Junio C Hamano35bb3f62007-02-19 05:35:53921<pre><tt>[i18n]
Junio C Hamano775a0f42006-12-31 01:19:14922 logoutputencoding = ISO-8859-1</tt></pre>
923</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31924<div class="para"><p>If you do not have this configuration variable, the value of
925<tt>i18n.commitencoding</tt> is used instead.</p></div>
Junio C Hamano775a0f42006-12-31 01:19:14926</li>
Junio C Hamanoba4b9282008-07-06 05:20:31927</ol></div>
928<div class="para"><p>Note that we deliberately chose not to re-code the commit log
Junio C Hamano775a0f42006-12-31 01:19:14929message when a commit is made to force UTF-8 at the commit
930object level, because re-coding to UTF-8 is not necessarily a
Junio C Hamanoba4b9282008-07-06 05:20:31931reversible operation.</p></div>
Junio C Hamano775a0f42006-12-31 01:19:14932</div>
Junio C Hamanoba4b9282008-07-06 05:20:31933<h2 id="_author">Author</h2>
Junio C Hamanod9d71c02006-02-08 00:52:33934<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31935<div class="para"><p>Written by Linus Torvalds &lt;torvalds@osdl.org&gt; and
Junio C Hamano0868a302008-07-22 09:20:44936Junio C Hamano &lt;gitster@pobox.com&gt;. Significantly enhanced by
Junio C Hamanoba4b9282008-07-06 05:20:31937Johannes Schindelin &lt;Johannes.Schindelin@gmx.de&gt;.</p></div>
Junio C Hamanod9d71c02006-02-08 00:52:33938</div>
Junio C Hamanoba4b9282008-07-06 05:20:31939<h2 id="_documentation">Documentation</h2>
Junio C Hamanod9d71c02006-02-08 00:52:33940<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31941<div class="para"><p>Documentation by David Greaves, Petr Baudis and the git-list &lt;git@vger.kernel.org&gt;.</p></div>
Junio C Hamanod9d71c02006-02-08 00:52:33942</div>
Junio C Hamanoba4b9282008-07-06 05:20:31943<h2 id="_git">GIT</h2>
Junio C Hamanod9d71c02006-02-08 00:52:33944<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31945<div class="para"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamanod9d71c02006-02-08 00:52:33946</div>
947<div id="footer">
948<div id="footer-text">
Junio C Hamanoa9701f02010-01-21 00:42:16949Last updated 2010-01-21 00:41:40 UTC
Junio C Hamanod9d71c02006-02-08 00:52:33950</div>
951</div>
952</body>
953</html>